#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;



	/// <summary>
	/// Summary for WinFormCtrlHostControl
	/// </summary>
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	public ref class WinFormCtrlHostControl : public System::Windows::Forms::UserControl
	{
	public:
		WinFormCtrlHostControl(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}
		bool SetControl(Control^ ctrl)
		{
			this->SuspendLayout();
			ctrl->Dock = System::Windows::Forms::DockStyle::Fill;
			this->Controls->Add(ctrl);
			this->ResumeLayout(false);
			return true;

		}
		bool SetControl(System::String^ p1,System::String^ p2)
		{
			//return true;
			System::Reflection::Assembly^ assem = System::Reflection::Assembly::LoadFile(p1);
			Control^ m_ctrl = (Control^)assem->CreateInstance(p2)  ;

			bool ret = this->SetControl(m_ctrl);
			return ret;
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~WinFormCtrlHostControl()
		{
			if (components)
			{
				delete components;
			}
		}
	protected: 

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container^ components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			
			this->SuspendLayout();
			
			// 
			// WinFormCtrlHostControl
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			
			this->Name = L"WinFormCtrlHostControl";
			this->ResumeLayout(false);

		}
#pragma endregion
	};

